package apiexample.transform.util;

import apiexample.transform.datastructure.UsageExample;

public class ProgrammingEleConstructer {
	public static String consturctProgrammingEle(UsageExample example){
		//dt:class1,class2,;dm:method1,method2,;rt:reftype1,reftype2,;rm:refmethod1,refmethod2,;
		StringBuffer result = new StringBuffer();
		if(example.declaredTypeNames.size()>0){
			result.append("dt:");
			for(String dt:example.declaredTypeNames){
				result.append(dt+",");
			}
			result.append(";");
		}		
		
		if(example.declaredMethodNames.size()>0){
			result.append("dm:");
			for(String dm:example.declaredMethodNames){
				result.append(dm+",");
			}
			result.append(";");
		}		
		
		if(example.referencedTypeNames.size()>0){
			result.append("rt:");
			for(String rt:example.referencedTypeNames){
				result.append(rt+",");
			}
			result.append(";");
		}
		
		if(example.referencedMethodNames.size()>0){
			result.append("rm:");
			for(String rm:example.referencedMethodNames){
				result.append(rm+",");
			}
			result.append(";");
		}		
		
		return result.toString();
	}
}
